<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    let sales = [
      { name: '小明', age: 18, gender: '男', money: 30, status: 0 },
      { name: '小红', age: 26, gender: '女', money: 99, status: 3 },
      { name: '小刚', age: 19, gender: '男', money: 88, status: 2 },
      { name: '小丽', age: 20, gender: '女', money: 67, status: 1 },
      { name: '晓强', age: 23, gender: '女', money: 77, status: 1 },
      { name: '小张', age: 25, gender: '女', money: 80, status: 2 },
    ]
    for (let i = 0; i < sales.length; i++) {
      // if (sales[i].money < sales[i + 1].money) {
      //     let ojk = sales[i]
      //     sales[i] = sales[i + 1]
      //     sales[i + 1] = ojk
      // }
      // console.log(a[i].status);
      switch (sales[i].status) {
        case 0:
          sales[i].status = '未及格'
          break
        case 1:
          sales[i].status = '及格'
          break
        case 2:
          sales[i].status = '良好'
          break
        default:
          sales[i].status = '优秀'
      }
      function fn(a) {
        document.write(`
                    <tr>
                        <td> ${i + 1}</td>
                        <td> ${a[i].name}</td>
                        <td>${a[i].age}</td>
                        <td>${a[i].gender}</td>
                        <td>${a[i].money}w</td>
                        <td>${a[i].status}</td>
                        </tr>`)
      }
      let dayin = fn(sales)
      console.log(dayin);

    }



        // console.log(sales);
  </script>
</body>

</html>